//Roman to Integer , Integer to Roman
/*
#include <vector>
#include <time.h>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
using namespace std;

string intToRoman(int num) {
	string str[] ={"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
	int val[] = { 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 };
	string re="";
	for (int i = 0; num > 0; i++) {
		while (num >= val[i]) {
			num -= val[i];
			re+=str[i];
		}
	}
	return re;
}
int find(string te){
	string str[] ={"CM","CD","XC","XL","IX","IV","I","M","D","C","L","X","V"};
	int val[] = {900, 400, 90, 40, 9, 4, 1 ,1000, 500, 100, 50, 10, 5};
	for(int i=0;i<13;i++){
		if(str[i]==te){
			return val[i];
		}
	}
	return 0;
}
int romanToInt(string num) {
	int val=0;
	int re=0;
	string te="";
	int index;
	bool flag=true;
	for (int i = 0; i<num.length();) {
		te="";
		flag=true;
		if(i+1<num.length()){
			te+=num[i];
			te+=num[i+1];
			index=find(te);
			if(index){
				re+=index;
				i+=2;
				flag=false;
			}
		}
		if(flag){
			te=num[i];
			index=find(te);
			if(index){
				re+=index;
				i++;
			}
		}
	}
	return re;
}
int main(){
	string str;
	while(cin>>str){
		cout<<"********"<<endl;
		cout<<romanToInt(str)<<endl;
	}
	system("pause");
	return 0;
}
*/